#header{

}# #body{

<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-title">
				<h5></h5>
			</div>
			<div class="ibox-content">
				<form method="post" action='!!SplitUrl(sprintf(" homepage/column/%supdate ",self::$db_hlo))!!'>
					<input name="id" value="!!isset($output[0])?$output[0]:'0'!!" hidden/>
					<input name="data[img1]" id="img1" value="!!isset($output[0])?$output['img1']:''!!" hidden/>

					<div class="form-horizontal m-t">
						<div class="form-group">
							<label class="col-sm-1 control-label">主题：</label>
							<div class="col-sm-2">
								<input class="form-control" name="data[title]" size="10" type="text" value="!!isset($output[0])?$output['title']:''!!" />
								<span class="field-validation-error" veri-for=""></span>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-1 control-label">关键字：</label>
							<div class="col-sm-10">
								<input class="form-control" name="data[keywords]" size="10" type="text" value="!!isset($output[0])?$output['keywords']:''!!" />
								<span class="field-validation-error" veri-for=""></span>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-1 control-label">描述：</label>
							<div class="col-sm-10">
								<input class="form-control" name="data[description]" size="10" type="text" value="!!isset($output[0])?$output['description']:''!!" />
								<span class="field-validation-error" veri-for=""></span>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-1 control-label">落款：</label>
							<div class="col-sm-5">
								<input class="form-control" name="data[Inscribe]" size="10" type="text" value="!!isset($output[0])?$output['Inscribe']:''!!" /> <span class="field-validation-error" veri-for=""></span>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-1 control-label">音乐自动播放：</label>
							<div class="col-sm-2">
								<div class="btn_fath clearfix !{if $output['musicPlay']==0}off!{else}on!{/if}" onclick="toogle(this)">
									<div class="move" data-state="!{if $output['musicPlay']==0}off!{else}on!{/if}"></div>
									<!--状态参数不要有空格-->
									<div class="btnSwitch btn1">ON</div>
									<div class="btnSwitch btn2 ">OFF</div>
									<input name="data[musicPlay]" hidden value="!!$output['musicPlay']!!" />
								</div>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-1 control-label">主体文字颜色：</label>
							<div class="col-sm-4">
								<input id="Df_color" name='data[color]' value="!!isset($output[0])?$output['color']:''!!" />
							</div>
						</div>

						<div class="form-group">
							<!--加载多张背景图会拖网速，所以只用一张-->
							<label class="col-sm-1 control-label">背景图片：</label>1920*1280
							<div class="col-sm-4">
								<div class="upload">
									<div id="uploadPreview1">
										!!isset($output[0])?"<img src='{$output["img1"]}' />":'暂无图片'!!
									</div>
									<div class="left">
										<div class="uploadProgressBar"></div>
										<div id="uploadBut1">选择图片</div>
									</div>
									<div class="clear"></div>
								</div>
							</div>
						</div>
						
						
					<div class="form-group">
							<!--加载多张背景图会拖网速，所以只用一张-->
							<label class="col-sm-1 control-label">字体：</label>1920*1280
							<div class="col-sm-4">
								<div class="upload">
									<div id="uploadPreview2">
										/css_js/FontFamily/font.TTF 
									</div>
									<div class="left">
										<div class="uploadProgressBar"></div>
										<div id="uploadBut2">选择字体文件</div>
									</div>
									<div class="clear"></div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="wrapper">
								<ul>
									!{each $img}

									<li id="img_!`Id`">
										<div class="picBox">
											<div class="show">
												<img height="180px" width="180px" src="!`img`">
											</div>
											<div class="hide">
												<h3> 
<a href="javascript:selePic('!`img`')">使用</a>

<a href="javascript:delPic('!`Id`')" onclick='return confirm("确认删除吗？")'>删除</a>
</h3>
											</div>
										</div>
									</li>
									!{/each}

								</ul>
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-2 col-sm-offset-1">
								<button class="btn btn-primary" onclick="return submit_form()">保存</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

}# #footer{

<!-- webuploader-->
<link rel="stylesheet" href="/css_js/webuploader/webuploader.css" type="text/css" />
<script src="/css_js/webuploader/webuploader.min.js"></script>
<script type="text/javascript">
	//验证输入
	function verify() {
		if($("input[name='data[title]']").val() == "") {
			$("[name='data[title]']").next().html('请输入标题')
			return false;
		}
		if($("#html").val() == "<p><br></p>") {
			$("[veri-for='Body']").html('请输入内容')
			return false;
		}
		return true;
	}

	function submit_form() {
		$("#html").val($("#Body").html());
		return verify();
	}

	//上传图片
	function uploadImg(button, div, input) {

		var uploader = WebUploader.create({
			// 自动上传
			auto: true,
			// 选择文件的按钮
			pick: button,
			// swf文件路径
			swf: '/content/www/lib/webuploader/Uploader.swf',
			// 文件接收服务端。
			server: '!!SplitUrl(sprintf("homepage/column/%sPicUp/file",self::$db_hlo))!!',
			method: 'POST'
		});
		uploader.on('uploadProgress', function(file, percentage) {
			$(div).html("上传中...");
		});

		uploader.on('uploadSuccess', function(file, response) {
			//文件效验
			if(response == "-1") //简单的图片上传需要验证
				$(div).html('文件出错');
			else if(response == "-2")
				$(div).html('类型不允许');
			else if(response == "-3")
				$(div).html('文件太大');
			else {
				//获取原始数据
				var data = response._raw;
//				log(response)
				$(div).html("<img src=\"" + data + "\"  />");
				$(input).val(data);
			}
		});

		uploader.on('uploadError', function(file) {
			$(div).html("上传失败");
		});

	}
	
	function upload(button, div, input) {

		var uploader = WebUploader.create({
			// 自动上传
			auto: true,
			// 选择文件的按钮
			pick: button,
			// swf文件路径
			swf: '/content/www/lib/webuploader/Uploader.swf',
			// 文件接收服务端。
			server: '!!SplitUrl(sprintf("homepage/column/%sUp/upfile",self::$db_hlo))!!',
			method: 'POST'
		});
		
		
			 $(div).html('<div class="progress-out"><div class="percent-show"><span>0</span>%</div>    <div class="progress-in direction-left" style="width: 0%;"></div></div>!!$output['pic']!!');
		
		 
		
		
		
		uploader.on('uploadProgress', function(file, percentage) {
//			console.log(file)
			
			per=Math.round(percentage*100) 
//			console.log(per)
//			$(div).html("上传中..."+percentage);
			$(".progress-out").myProgress({
							speed: 100,
							percent:per,
							width: "100%",
							height: "30px"
						});
		});

		uploader.on('uploadSuccess', function(file, response) {
			
			//文件效验
			if(response == "-1") //简单的图片上传需要验证
				$(div).html('文件出错（超出服务器允许上传的体积，请设置php.ini）');
			else if(response == "-2")
				$(div).html('类型不允许');
			else if(response == "-3")
				$(div).html('文件太大');
			else {
				//获取原始数据
				var data = response._raw;
				$(div).html("<div>" + data + "</div>");
				$(input).val(data);
			}
		});

		uploader.on('uploadError', function(file) {
			$(div).html("上传失败");
		});

	}
	//上传图片
	$(function() {
		uploadImg('#uploadBut1', "#uploadPreview1", "#img1");

	})

	function selePic(src) {

		$('#img1').val(src)
		$('.uploadPreview1').children().attr('src', src);

	}

	function delPic(id) {

		Pure_UrlPost('!!SplitUrl(sprintf("homepage/column/%sPicDel",self::$db_hlo))!!', {
			id: id
		}, function(x) {

			$('#img_' + id).remove();
		})

	}
</script>



}#